// index.js
// pages/index/index.js
import DeepSeekSDK from '../../utils/deepseek-sdk';

Page({
  data: {
    responseText: null,
    value: ''
  },
  
  async callDeepSeek() {
    console.log(this.data.value);
    this.setData({ 
      responseText: '正在思考...',
    });
    const sdk = new DeepSeekSDK('sk-0d0d3bbdd8c844d68eb2e3e555a35675');
    try {
      const result = await sdk.generateText(this.data.value);
      console.log(`${result}`)
      this.setData({ 
        responseText: result,
        value: ''
      });
    } catch (error) {
      this.setData({ 
        responseText: '出错了',
      });
    }
  }
})